package org.jeecg.modules.htxincailiao.industry.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.htxincailiao.industry.entity.HTIndustryExhibitionCheck;

import java.util.List;

/**
 * @Description: ht_industry_exhibition_check
 * @Author: jeecg-boot
 * @Date: 2021-12-21 17:55:12
 * @Version: V1.0
 */
public interface HTIndustryExhibitionCheckMapper extends BaseMapper<HTIndustryExhibitionCheck> {

    @Select("<script>" +
            "SELECT * FROM ht_industry_exhibition_check" + " " +
            "WHERE exhibition_id=#{exhibitionId} AND code=#{code}" +
            "</script>")
    HTIndustryExhibitionCheck queryByCode(@Param("exhibitionId") String exhibitionId, @Param("code") String code);

    @Select("<script>" +
            "SELECT * FROM ht_industry_exhibition_check" + " " +
            "WHERE exhibition_id=#{exhibitionId} AND user_id=#{userId}" +
            "</script>")
    HTIndustryExhibitionCheck queryByUser(@Param("exhibitionId") String exhibitionId, @Param("userId") String userId);


    @Select("<script>" +
            "SELECT * FROM ht_industry_exhibition_check" + " " +
            "WHERE exhibition_id=#{exhibitionId} AND buyer_id=#{buyerId}" +
            "</script>")
    HTIndustryExhibitionCheck queryByBuyerId(@Param("exhibitionId") String exhibitionId, @Param("buyerId") String buyerId);

    @Select("<script>" +
            "SELECT COUNT(*) FROM ht_industry_exhibition_check" + " " +
            "WHERE exhibition_id=#{exhibitionId} AND is_checked_in=1" +
            "</script>")
    Integer getCheckSerialNumber(@Param("exhibitionId") String exhibitionId);

    @Select("<script>" +
            "SELECT * FROM ht_industry_exhibition_check" + " " +
            "WHERE exhibition_id=#{exhibitionId} AND buyer_id=#{buyerId}" +
            "</script>")
    List<HTIndustryExhibitionCheck> findAll(@Param("exhibitionId") String exhibitionId, @Param("buyerId") String buyerId);

}
